//引入Vue和VueRouter
import Vue from "vue"
import VueRouter from "vue-router"

//引入路由列表
import routes from "./routes"

// 使用VueRouter
Vue.use(VueRouter)

// 创建路由器对象
const router = new VueRouter({
    mode: "history",
    routes: routes
})

// 重写push
let oldPush = VueRouter.prototype.push
VueRouter.prototype.push = function (location, success = () => {}, unsuccess = () => {}) {
    oldPush.call(this, location, success, unsuccess)
}

//暴露路由器对象
export default router